// Selecting Elements by ID
// Note IDs must be unique per page.
$( "#myId" ); // <div id="myId">

// Selecting Elements by Class Name
$( ".myClass" ); // <div class="myClass">

// Selecting Elements by Attribute
//<input name="first_name">
$( "input[name='first_name']" );

// Selecting Elements by Compound CSS Selector
//  <div id="contents">
//      <ul class="people">
//        <li></li><li></li>
//      </ul>
//  </div>
$( "#contents ul.people li" );


// [Pseudo-Selectors]
// <a class="external">
// <a class="external">
$( "a.external:first" );
$( "tr:odd" );
$( "div:visible" );

// Select all input-like elements in a form (more on this below).
// <form id="myForm">
// 	  <input ~> <textarea> 
// </form>
$( "#myForm :input" );

// All except the first three divs.
$( "div:gt(2)" );

// All currently animated divs.
$( "div:animated" );



// [Choosing Selectors]
// Find all <a> elements whose rel attribute ends with "thinger".
// <a rel="do-nothinger">
$( "a[rel$='thinger']" );

//Doesn't work!
/*if ( $( "div.foo" ) ) {
...
}*/
//Testing whether a selection contains elements.
if ( $( "div.foo" ).length ) {

}

// Saving Selections
var divs = $( "div" );

// Refining & Filtering Selections
// div.foo elements that contain <p> tags
// <div class="foo"><p></p></div>
$( "div.foo" ).has( "p" ); 
$( "h1" ).not( ".bar" ); // h1 elements that don't have a class of bar
$( "ul li" ).filter( ".current" ); // unordered list items with class of current
$( "ul li" ).first(); // just the first unordered list item
$( "ul li" ).eq( 5 ); // the sixth



// [Selecting Form Elements]
// Using the :button pseudo-selector targets any <button> elements and elements with a type="button"
$( "form :button" );

// Using the :checkbox pseudo-selector targets any <input> elements with a type="checkbox"
$( "form :checkbox" );

// :checked targets checked checkboxes, but keep in mind that this selector works also for checked 
// radio buttons, and select elements (for select elements only, use the :selected selector):
$( "form :checked" );

// Using the :disabled pseudo-selector targets any <input> elements with the disabled attribute:
$( "form :disabled" );

// Basically the inverse of the :disabled pseudo-selector, the :enabled pseudo-selector targets 
// any elements that do not have a disabled attribute:
$( "form :enabled" );

// Using the :file pseudo-selector targets any <input> elements that have a type="file":
$( "form :file" );

// Using the :image pseudo-selector targets any <input> elements that have a type="image":
$( "form :image" );

// Using the :input selector selects all <input>, <textarea>, <select>, and <button> elements
$( "form :input" );

// Using the :password pseudo-selector targets any <input> elements with a type="password":
$( "form :password" );

// Using the :radio pseudo-selector targets any <input> elements that have a type="radio"
$( "form :radio" );

//Selects all radio buttons with the name attribute of gender.
$( "form input[name='gender']:radio" );

// Using the :reset pseudo-selector targets any <input> elements that have a type="reset":
$( "form :reset" );

// Using the :selected pseudo-selector targets any selected items in <option> elements:
$( "form :selected" );

// sing the :submit pseudo-selector targets any <button> or <input> elements with a type="submit"
$( "form :submit" );

// Using the :text pseudo-selector targets any <input> elements with a type="text":
$( "form :text" );